in the main process